#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project ：api_automation_test 
@File    ：conftest.py
@IDE     ：PyCharm 
@Author  ：XiaoDengYa
@Date    ：2021/7/21/021 18:03 
"""
import pytest
from common.tools.dingding_push import SendMessage


@pytest.mark.hookwrapper
def pytest_runtest_makereport(item):
    outcome = yield
    report = outcome.get_result()
    report.description = str(item.function.__doc__)

    if report.when == 'call' or report.when == "setup":
        xfail = hasattr(report, 'wasxfail')
        if (report.skipped and xfail) or (report.failed and not xfail):
            SendMessage().run_send("测试一下啦！")
